<include file="_head,_download_app"/>


<section class="seller_box">
    <div class="seller_t">
        <if condition="empty($merch_pics['thumb'])">
            <img src="__PUBLIC__/H5asset/images/default_merch_logo.png"/>
            <else />
            <img src="{$merch_pics['thumb']}?imageView2/1/w/480/h/480"/>
        </if>
        <div class="seller_logo"><img src="{$merch_pics['avatar']|default='__PUBLIC__/H5asset/images/default_merch_logo.png'}"/></div>
        <h3>{$merch_name}</h3>

        <empty name="Think.get.token">
                <div class="seller_add">
                    <p><span>位置：</span>{$floor_name}</p>
                    <p><span>电话：</span>{$merch_contact}</p>
                </div>
            <else />
                <div class="seller_add seller_add_app">
                    <p>{$floor_name}<i id="location-navi" data-address="{$map_address}"></i></p>
                    <p><a href="tel:{$merch_contact}">{$merch_contact}</a><i id="call" data-phone="{$merch_contact}"></i></p>
                </div>
        </empty>
    </div>

    <div class="seller_info">


        <if condition="count($merch_pics['photos']) GT 0 ">
            <div class="seller_i_c">
                <div class="hd">
                    <h3>商户展示</h3>
                    <p>store display</p>
                </div>
                <div class="bd">
                    <div class="seller_imgs">
                        <ul class="cf">
                            <volist name="merch_pics['photos']" id="vo" key="k">


                                <if condition="$k lt 5 ">

                                    <li><img src="{$vo}?imageView2/1/w/200/h/200" data-start="{$k}"></li>
                                </if>

                            </volist>
                        </ul>
                    </div>
                </div>
            </div>
        </if>


        <notempty name="goods">
            <div class="seller_i_c">
                <div class="hd">
                    <h3>商品展示</h3>
                    <p>goods display</p>
                </div>
                <div class="bd">
                    <div class="seller_pro_list">
                        <div class="swiper-wrapper">
                            <volist name="goods" id="vo" key="k">

                                <div class="swiper-slide">


                                    <a data-id="{$vo['id']}" data-title="{$vo['goods_name']}" >
                                        <img src="{$vo['goods_pics']}?imageView2/1/w/200/h/200">
                                        <h4>{$vo['goods_name']}</h4>
                                        <p><span>¥</span>{$vo['goods_price']}</p>
                                    </a>


                                </div>


                            </volist>

                        </div>
                    </div>
                </div>
            </div>



        </notempty>


        <div class="seller_i_c" >
            <a name="comment"></a>
            <div class="hd">
                <h3>评论留言({:count($comments)})</h3>
                <p>Comment message </p>
            </div>
            <div class="bd">
                <div class="seller_mes">
                    <volist name="comments" id="vo" key="k">
                        <if condition="$k lt 6">
                            <dl class="cf">
                                <dt><img src="{$vo['avatar']|default='__PUBLIC__/H5asset/images/default_avatar.png'}"/></dt>
                                <dd>
                                    <div class="t">
                                        <h5>{$vo['user_name']}</h5>
                                        <p>{$vo['create_time']}</p>
                                    </div>
                                    <div class="c">{$vo['content']}</div>
                                </dd>
                            </dl>
                        </if>


                    </volist>
                    <if condition="count($comments) GT 4">


                        <a id="more-comments" data-id="{$_GET['id']}"  href="{:U('/H5/Web/comment_page',  ['merch_id'=>$_GET['id']]   )}" class="seller_more">查看全部评论&gt;&gt;</a>


                    </if>

                    <if condition="count($comments) eq 0">


                        <img src="/public/H5asset/images/norecord.png">


                    </if>

                </div>

                <if condition="empty($_GET['token'])">
                    <a id="app-load-url" href="{$ios}" class="downmore" data-android="{$android}">下载世界之花app，查看更多精彩评论</a>
                    <script>
                        var u = navigator.userAgent;
                        var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
                        if (isAndroid) {
                            loadUrl = $('#app-load-url').data('android');
                            $("#app-load-url").attr("href", loadUrl)
                        }
                    </script>
                </if>
            </div>
        </div>
    </div>
</section>
<script>
    var swiper = new Swiper('.seller_pro_list', {
        pagination: '.swiper-pagination',
        slidesPerView: 'auto',
        paginationClickable: true,
        spaceBetween: 20,
        freeMode: true
    });

    var pictureUrls = $('.cf li img').map(function(){
        return $(this).attr('src')
    }).get();
    var total = parseInt(pictureUrls.length) ;

    $(function () {
        $('.swiper-slide a').click(function () {
            event.preventDefault();
            var id = $(this).data('id');
            var title = $(this).data('title');
            MobileApi.pushToGoodsDetail(id,title);
        });


        $('.cf li img').click(function () {

            event.preventDefault();
            var start = $(this).data('start');
            MobileApi.lookPictures(total,start,pictureUrls);
        });

        $('#location-navi').click(function () {
            var address = $(this).data('address');
            MobileApi.onNavgateClick(address);
        });

        $('#call').click(function () {
            event.preventDefault();
            var phone = $(this).data('phone');
            MobileApi.onCallClick(phone);
        });



        $('#more-comments').click(function () {
            event.preventDefault();
            var host = "{:C(host)}";
            var url = host + $(this).attr('href');
            var id = $(this).data('id');

            MobileApi.onPushCommentClick(id,url);
        });
    })



</script>
</body>
</html>